// utils.h : utils
// 2009-09

#ifndef INCLUDED_UTILS_H
#define INCLUDED_UTILS_H

#define PR_IP( x ) \
	do { \
		unsigned char *_ip = (unsigned char *)&(x);	\
		printf( "%hd.%hd.%hd.%hd", _ip[3], _ip[2], _ip[1], _ip[0] ); \
	} while( 0 );

#define LOG_ERR( fmt, ... ) fprintf( stderr, "ERR: " fmt "\n", ## __VA_ARGS__ )
#define LOG_CRIT( fmt, ... ) \
	do { \
		LOG_ERR( fmt, ## __VA_ARGS__ );	\
		exit( EXIT_FAILURE ); \
	} while( 0 )

#endif // INCLUDED_UTILS_H
